import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:lcapp/api/interface/user_api.dart';
import 'package:lcapp/api/request/response_data.dart';
import 'package:lcapp/config/const_config.dart';
import 'package:lcapp/data/user_data_entity.dart';
import 'package:lcapp/model/refresh/refresh.dart';
import 'package:lcapp/page/min/follow_fans_list_page.dart';
import 'package:lcapp/page/search/search_user_item.dart';
import 'package:lcapp/widget/asr_app_bar.dart';
import 'package:lcapp/widget/custom_indicator.dart';
import 'package:lcapp/widget/custom_tabs.dart';

class FollowUsersPage extends StatefulWidget {
  final int index;
  const FollowUsersPage({Key? key, this.index=0}) : super(key: key);

  @override
  _FollowUsersPageState createState() => _FollowUsersPageState();
}

class _FollowUsersPageState extends State<FollowUsersPage> with SingleTickerProviderStateMixin{

  late TabController tabController;
  int pageNum = 1;
  int pageSize  =10;
  List<UserDataEntity> users = [];

  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    tabController = TabController(length: 3, vsync: this);
    tabController.index = widget.index;
  }



  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AsrAppBar(
        barColor: Colors.white,
        backgroundColor: defaultBarColor,
        title: Container(
          width: 350.w,
          child: TabBar(
            controller: tabController,
            labelPadding: EdgeInsets.zero,
            indicatorPadding: EdgeInsets.zero,
            // indicator: CustomIndicator(
            //     type: CustomIndicatorType.LineRect,
            //     height: 2,
            //     width: 30.w,
            //     color: Colors.white),
            labelColor: Colors.white,
            labelStyle: TextStyle(
              fontSize: 38.sp,
              color: Colors.white,
              fontWeight: FontWeight.w600,
            ),
            unselectedLabelColor: Colors.white,
            unselectedLabelStyle: TextStyle(
              fontSize: 34.sp,
              color: Colors.white,
              fontWeight: FontWeight.w400,
            ),
            tabs: const [
              Text("意向"),
              Text("粉丝"),
              Text("关注"),
            ],
          ),
        ),
      ),
      body: Container(
        child: TabBarView(
          controller: tabController,
          children: const [
            FansFollowsListPage(type: 0,),
            FansFollowsListPage(type: 1,),
            FansFollowsListPage(type: 2,),
          ],
        ),
      ),
    );
  }
}
